package com.maker.mcp.client.controller;


import com.maker.mcp.client.bean.ChatEntity;
import com.maker.mcp.client.service.ChatService;
import com.maker.mcp.client.service.SearXngService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("internet")
public class InternetController {
    @Resource
    private SearXngService searXngService;

    @Resource
    private ChatService chatService;
    @GetMapping(value="/test",produces =  "text/html;charset=UTF-8")
    public Object test(@RequestParam String query){

        return   searXngService.search( query);
    }

    @PostMapping(value="/search",produces =  "text/html;charset=UTF-8")
    public void search(@RequestBody ChatEntity chatEntity){

        chatService.doInternetSearch(chatEntity);
    }

}
